package net.crazyadam.audio;

import android.app.Activity;
import android.media.MediaPlayer;

/**
 * Copyright by <a href="http://crazyadam.net"><em><i>Joseph J.C. Tang</i></em></a> <br/>
 * Email: <a href="mailto:jinntrance@gmail.com">jinntrance@gmail.com</a>
 *
 * @author joseph
 * @version 1.0
 * @since 10/5/12 12:23 PM
 */
public class DopplerPlayer {
    private MediaPlayer mp;

    /**
     *
     * @param activity context of the media player
     * @param audioId  id from R.raw.audio
     */
    public DopplerPlayer(Activity activity,int audioId) {
        mp = MediaPlayer.create(activity.getBaseContext(),audioId);

    }

    /**
     * 播放音频
     * */
    public void start(){
        mp.setLooping(true);
        mp.start();
    }

    /**
     * 停止音频播放
     */
    public void stop(){
       mp.release();
//       mp.stop();
    }
}
